﻿#ifndef GENEALOGY_H
#define GENEALOGY_H

#include <QWidget>
#include <QEvent>
#include <QMenu>
#include <QAction>
#include <QParallelAnimationGroup>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
#include <qt_windows.h>
#include <Windowsx.h>
#include <QAction>
#include <QComboBox>
#include <QPushButton>
#include <QDebug>
#include <QGraphicsScene>
#include <QGraphicsTextItem>
#include <QScrollBar>
#include <QMargins>
#include <QSize>
#include <QFile>
#include <QScreen>
#include <QMenu>
#include <QGridLayout>
#include <QtWidgets>
#include "titlebar.h"
#include "menubar.h"
#include "toolwidget.h"
#include "displaywidget.h"
#include "treedata.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Genealogy; }
QT_END_NAMESPACE


class Genealogy : public QWidget
{
    Q_OBJECT

public:
    Genealogy(QWidget *parent = nullptr);
    ~Genealogy();
    Tree treeData;
protected:
    bool nativeEvent(const QByteArray &eventType, void *message, long *result)override;
    void closeEvent(QCloseEvent*event)override;//override关闭事件
private slots:
    void closeToolAreaAnima();
    void showToolAreaAnima(int type);
    void updateTheme(int newTheme);
    void openFile();
    void newFile();
    void closeFile();
private:
    void initConnections();
    void initWidget();
    void initAnim();
    void updateFilePath(QString filePate, QString fileName);

    Ui::Genealogy *ui;

    //右键菜单选项
    QMenu* itemMenu;
    QAction* toItemDetailAction;
    QAction* deleteItemAction;
    QAction* newItemAsChildAction;
    QAction* newItemAsMateAction;
    QAction* ID;

    //过渡动画
    QParallelAnimationGroup* paraAnimGroup1;
    QParallelAnimationGroup* paraAnimGroup2;
    QPropertyAnimation* posAnimation1;
    QPropertyAnimation* posAnimation2;
    QPropertyAnimation* posAnimation3;
    QPropertyAnimation* scaleAnimation1;
    QPropertyAnimation* scaleAnimation2;

    //整个界面的各部分
    TitleBar* titleBar;//标题栏
    ToolWidget* toolWidget;//工具区域
    DisplayWidget* displayWidget;//显示区域
    MenuBar* menuBar;//菜单栏

    //一些参数
    int pageType;//工具区域的页面编号
    QList<QColor> themeColors;//颜色主题的各种颜色的代码
    int themeIndex;//颜色主题的编号
    QString curFilePath;//打开文件的路径
    bool isFileOpening;//文件打开与否的布尔值
};
#endif // GENEALOGY_H
